#!/bin/sh

# https://www.rabbitmq.com/clustering-ssl.html
ERL_SSL_PATH="$(erl -eval 'io:format("~p", [code:lib_dir(ssl, ebin)]),halt().' -noshell)"

sslErlArgs="-pa $ERL_SSL_PATH -proto_dist inet_tls -ssl_dist_optfile /etc/rabbitmq/inet-dist-tls.config"

SERVER_ADDITIONAL_ERL_ARGS="$sslErlArgs"
CTL_ERL_ARGS="$sslErlArgs"

if [ -n "$ERLANG_COOKIE" ]; then
	SERVER_ADDITIONAL_ERL_ARGS="$SERVER_ADDITIONAL_ERL_ARGS -setcookie $ERLANG_COOKIE"
	CTL_ERL_ARGS="$CTL_ERL_ARGS -setcookie $ERLANG_COOKIE"
fi
